package com.dy;

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Bean;

/**
 * @ClassName:
 * @Author: 仄言in
 * @Desctiption: (描述)
 * @Date: 2021/4/8 10:05
 * @Version 1.0 (版本)
 */
@SpringBootApplication
@EnableDiscoveryClient  //开启服务提供者
public class Springcloud8081Application {
    public static void main(String[] args) {
        SpringApplication.run(Springcloud8081Application.class,args);
    }
    //增加一个servlet
    @Bean
    public ServletRegistrationBean e(){
        ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new HystrixMetricsStreamServlet());
        servletRegistrationBean.addUrlMappings("/actuator/hystrix.stream");
        return servletRegistrationBean;
    }
}
